package com.bjar;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class Main {

	private static String wholeString;
	private static String findString;

	public static void main(String[] args) {
		if (args.length == 2) {
			if (args.length > 1) {
				wholeString = getContentsOfFile(new File(args[0])) + "$";
				findString = args[1];
			} else {
				wholeString = "$";
				findString = "";
			}
			
			

		} else
			System.out.println("Not enough parameters provided.\r\n");
	}

	public static String getContentsOfFile(File file) {
		StringBuffer contents = new StringBuffer();
		BufferedReader reader = null;

		try {
			reader = new BufferedReader(new FileReader(file));
			String text = null;

			while ((text = reader.readLine()) != null) {
				contents.append(text).append(
						System.getProperty("line.separator"));
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				if (reader != null) {
					reader.close();
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}

		return contents.toString();
	}
}
